//
//  ZZCDynamicListCell.m
//  B段项目
//
//  Created by dllo on 15/12/25.
//  Copyright © 2015年 张智超. All rights reserved.
//

#import "ZZCDynamicListCell.h"

@interface ZZCDynamicListCell ()

@property (nonatomic, retain)UIImageView *dynamicImage;
@property (nonatomic, retain)UILabel *numLabel;
@property (nonatomic, retain)UILabel *nameLabel;

@end

@implementation ZZCDynamicListCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews
{
    self.dynamicImage = [[UIImageView alloc] initWithFrame:self.bounds];
    [self.contentView addSubview:self.dynamicImage];
    self.dynamicImage.contentMode = UIViewContentModeScaleAspectFill;
    self.dynamicImage.clipsToBounds = YES;
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.bounds];
    imageView.backgroundColor = [UIColor blackColor];
    imageView.alpha = 0.4;
    [self.dynamicImage addSubview:imageView];
    
    self.nameLabel = [[UILabel alloc] init];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    self.nameLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(self.bounds.size.height * 0.35);
        make.width.equalTo(self.mas_width);
        make.height.equalTo(self.mas_height).multipliedBy(0.25);
    }];
    
    self.numLabel = [[UILabel alloc] init];
    self.numLabel.textAlignment = NSTextAlignmentCenter;
    self.numLabel.textColor = [UIColor whiteColor];
    self.numLabel.font = [UIFont systemFontOfSize:10];
    [self.contentView addSubview:self.numLabel];
    [self.numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(self.bounds.size.height * 0.5);
        make.width.equalTo(self.mas_width);
        make.height.equalTo(self.mas_height).multipliedBy(0.25);
    }];
}

#pragma mark - set
-(void)setListModel:(ZZCDynamicModel *)listModel
{
    _listModel = listModel;

    self.nameLabel.text = self.listModel.tag;
    self.numLabel.text = [NSString stringWithFormat:@"%@条", self.listModel.count];
    
    NSURL *url = [NSURL URLWithString:self.listModel.img];
    [self.dynamicImage sd_setImageWithURL:url placeholderImage:PLACEHOLDER_IMAGE];
    
    
}


@end
